<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    body {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 369px;
      height: 369px;
      background-color: #ccc;
      margin: 200px;
      text-align: center;
    }
  </style>
</head>

<body>
  <div class="box">

  </div>
  <script>
    var box = document.querySelector('.box')
    var dataX = box.offsetTop
    var dataY = box.offsetLeft
    console.log(dataX, dataY)
    var pointX;
    var pointY;
    box.addEventListener('mousemove', function (e) {
      pointX = e.pageX - dataX;
      pointY = e.pageY - dataY
      box.innerHTML = `鼠标在盒子中的位置（ ${pointX} ，${pointY} ）`
    })

  </script>
</body>

</html>